<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src=".././static/js/jquery.min.1.11.3.js"></script>
    <script>
        console.log(localStorage.pathname)
        $(function() {
            $.ajax(basePath+'/specialBusiness/sysViewConfig',{
                dataType:'json',
                async: false,
                success:function(data){
                    if(data.code == 0){
                        headTitle = data.data.webName||headTitle;
                        sysName = data.data.sysName||sysName;
                        sysLogo = data.data.sysLogo || sysLogo;
                        copyRight = data.data.copyRight || copyRight;
                        webIcon = data.data.webIcon || webIcon
                        indexLink = data.data.indexLink || indexLink
                        indexLinkName = data.data.indexLinkName || indexLinkName
                        uploadType = data.data.uploadType
                        maxUpload = data.data.maxUpload
                        localStorage.setItem("headTitle",headTitle)
                        localStorage.setItem("sysName",sysName)
                        localStorage.setItem("sysLogo",sysLogo)
                        localStorage.setItem("copyRight",copyRight)
                        localStorage.setItem("webIcon",webIcon)
                        localStorage.setItem("indexLink",indexLink)
                        localStorage.setItem("indexLinkName",indexLinkName)
                        localStorage.setItem("uploadType",uploadType)
                        localStorage.setItem("maxUpload",maxUpload)
                        $("head").prepend('<title>'+ headTitle+'</title>')

                        if(webIcon !=null && webIcon != "" && webIcon != "null"){

                            $("head").append('<link rel="shortcut icon" href="../static/images/favicon.ico" type="image/x-icon" />')
                        }

                        $(".message").empty().append( sysName )
                    }
                }
            })

        })
    </script>
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src=".././static/js/public-head.js"></script>
</head>
<body class="login-bg">
    
    <div class="login layui-anim layui-anim-up">
        <div class="message">x-admin2.0-11管理登录</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" >
            <input name="userNo" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="passWord" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20" >
        </form>
    </div>

    <script>
        $(function  () {

            $("input[name=userNo]").val(localStorage.getItem("userNo")||'')

            layui.use('form', function(){
              var form = layui.form;
              // layer.msg('玩命卖萌中', function(){
              //   //关闭后的操作
              //   });
              //监听提交
              form.on('submit(login)', function(data){
				//console.log(JSON.stringify(data))
                  $.getJSON(basePath+"/loginAuth/login",data.field,function(item){
                      //console.log(JSON.stringify(item))
                        if(item.code == 0){
                            //alert(item.data.url)
                            localStorage.setItem("token",item.data.token)
                            localStorage.setItem("userName",item.data.userName)
                            localStorage.setItem("userNo",item.data.userNo)
                            localStorage.setItem("userGrade",item.data.userGrade)
                            $.cookie("token",item.data.token,{path:"/"+webContext} )
                            layer.msg("验证成功,页面跳转中...",function(){
                                location.href = item.data.url;
                            });
                        }else{
                            layer.msg(item.message)
                        }
                  });
                return false;
              });
            });
        })

        
    </script>

    
    <!-- 底部结束 -->
    <script type="text/javascript">

    </script>
</body>
</html>